#include "main.h"


/* 
 * ===  FUNCTION  ======================================================================
 *         Name:  strip_basket
 *  Description:  
 * =====================================================================================
 */
void basket_strip (GString *expr)
{
  gint i = 0, blank = 0;
  GString *tmp = g_string_new (NULL);

  for (i = 0; i < expr->len; i++) {
    if (expr->str[i] == ' ') {
      blank++;
    } else {
      blank = 0;
    }

    if (blank <= 1) {
      g_string_append_c (tmp, expr->str[i]);
    }
    
  }

  // add line terminator
  g_string_append_c (tmp, '\n');

  g_string_erase (expr, 0, -1);
  g_string_append (expr, tmp->str);
  g_string_free (tmp, TRUE);
}
